<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();

if($_GPC['keywords']){
	$op=$_GPC['keywords'];
	$where="%$op%";	
}else{
	$where='%%';
}

	/*	$sql="select *  from " . tablename("cjdc_user") ." WHERE  name LIKE :name  and uniacid=:uniacid";
	$list=pdo_fetchall($sql,array(':name'=>$where,'uniacid'=>$_W['uniacid']));*/
	$pageindex = max(1, intval($_GPC['page']));
	$pagesize=10;
	$sql="select uc.*,u.name as username,u.img,s.name as storename  from " . tablename("cjdc_user_collect") ." as uc left join " . tablename('cjdc_user'). " as u on u.id=uc.uid left join " . tablename('cjdc_store') . " as s on s.id=uc.store_id WHERE  u.name LIKE :name or s.name LIKE :name  and uc.uniacid=:uniacid ";
	$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;

	$list = pdo_fetchall($select_sql,array(':uniacid'=>$_W['uniacid'],':name'=>$where));	   
	$total=pdo_fetchcolumn("select count(*) from " . tablename("cjdc_user_collect") ." WHERE  name LIKE :name  and uniacid=:uniacid",array(':uniacid'=>$_W['uniacid'],':name'=>$where));
	$pager = pagination($total, $pageindex, $pagesize);
	if($_GPC['id']){
		$res4=pdo_delete("cjdc_user_collect",array('id'=>$_GPC['id']));
		if($res4){
		 message('删除成功！', $this->createWebUrl('collect'), 'success');
		}else{
			  message('删除失败！','','error');
		}
	}
include $this->template('web/collect');